<?php
	
	$data_title_arr = array();
	$data_title_arr[""] = PLEASE_SELECT_ARR ;
	$data_title_map_arr =  array();
	$data_cell_wsets = array();
	
	$data_title_week_arr =  array();
	$data_title_map_local_arr=  array();
	$data_title_week_arr[""] = PLEASE_SELECT_ARR ;
	
	//a.groupid ,a.title, a.size,a.area_id,a.area,a.exp_ins_flg,a.exp_ins_week 
	foreach ( $data_title as $k => $v) {
		$theID     =  $v["id"] ;
		$theTitle  =  $v["title"]."(".$v["area"].")".$v["size"] ;
		if ( $v["pattern_cd"]>0) {
			$data_title_map_local_arr[$theID]= array("title" => $theTitle, "map" => $v["map"], "saletickt"=> $v["saletickt"], "exp_ins_flg"=>  $v["exp_ins_flg"] );
			continue;
		}	
		$data_title_arr[$theID]  =  $theTitle;
		$data_title_map_arr[$theID]= array("map" => $v["map"], "saletickt"=> $v["saletickt"], "exp_ins_flg"=>  $v["exp_ins_flg"] );
		/*
		if (!empty( $v["block_copy_type"])) {
			if (!empty( $v["map"])) {
				$data_title_map_arr[$theID] = array(0 => 3, 1 => $v["map"] );
			} else {
				$data_title_map_arr[$theID] = array(0 =>  2,1 =>  0 );
			}
		}else {
				$data_title_map_arr[$theID]  = array(0 => 1, 1 => 0 );
		}
		*/
		if ( $v["exp_ins_flg"] == 1 ) {
			$weekid= $v["exp_ins_week"];
			$weekname = Class_PWD::int8_to_cell_title_dateD($weekid);
			
			if ($weekid) {
				$data_title_week_arr[$theID]  =  $theTitle;
				
				//$data_cell_wsets[$weekid]["name"] = $aoki_matrix_weeks[$weekid] ;
				$data_cell_wsets[$weekid]["name"] = $weekname ;
				
				
				$data_cell_wsets[$weekid]["title_cd"] = "tw{$weekid}_title" ;
				$data_cell_wsets[$weekid]["mp"]       = "tw{$weekid}_mp"    ;
				$data_cell_wsets[$weekid]["mpno"]     = "tw{$weekid}_mpno"  ;
				$data_cell_wsets[$weekid]["tp"]       = "tw{$weekid}_tp"    ;
				$data_cell_wsets[$weekid]["mo"]       = "tw{$weekid}_mo"    ;
				
				$data_cell_wsets[$weekid]["smpc_b2"] ="smcw{$weekid}_b2" ;
				$data_cell_wsets[$weekid]["pc_b2"] ="pcw{$weekid}_b2" ; 
				$data_cell_wsets[$weekid]["npc_b2"] ="npcw{$weekid}_b2" ;
				
				
				$data_cell_wsets[$weekid]["smpc_b3"] ="smcw{$weekid}_b3" ;
				$data_cell_wsets[$weekid]["pc_b3"] ="pcw{$weekid}_b3" ; 
				$data_cell_wsets[$weekid]["npc_b3"] ="npcw{$weekid}_b3" ;
				
				$data_cell_wsets[$weekid]["smpc_b4"] ="smcw{$weekid}_b4" ;
				$data_cell_wsets[$weekid]["pc_b4"] ="pcw{$weekid}_b4" ; 
				$data_cell_wsets[$weekid]["npc_b4"] ="npcw{$weekid}_b4" ;
			}
		}
	}
	$data_cell_wsets_local = array();
	for( $i = 1; $i <= 5; $i++ ) 
	{
		$data_cell_losets[$i] ["name"]    = "地域{$i}" ;
		
		$data_cell_losets[$i]["ltitle_cd"] = "ltlo{$i}_title" ;
		$data_cell_losets[$i]["title_cd"] = "tlo{$i}_title" ; 
		
		$data_cell_losets[$i]["mp"]   = "lo{$i}_mp" ; 
		$data_cell_losets[$i]["mpno"] = "lo{$i}_mpno" ;
		$data_cell_losets[$i]["tp"]   = "lo{$i}_tp" ;
		$data_cell_losets[$i]["mo"]   = "lo{$i}_mo" ;
	//	$data_cell_losets[$i]["isirgyu"]   = "lo{$i}_isirgyu" ;
		
		$data_cell_losets[$i]["pc_b2"]   = "pclo{$i}_b2" ; 
		$data_cell_losets[$i]["npc_b2"]  = "npclo{$i}_b2" ;
		$data_cell_losets[$i]["lpc_b2"]  = "lpclo{$i}_b2" ; 
		$data_cell_losets[$i]["lnpc_b2"] = "lnpclo{$i}_b2" ;
			
		$data_cell_losets[$i]["pc_b3"]   = "pclo{$i}_b3" ; 
		$data_cell_losets[$i]["npc_b3"]  = "npclo{$i}_b3" ;
		$data_cell_losets[$i]["lpc_b3"]  = "lpclo{$i}_b3" ; 
		$data_cell_losets[$i]["lnpc_b3"] = "lnpclo{$i}_b3" ;
				
		$data_cell_losets[$i]["pc_b4"]   = "pclo{$i}_b4" ; 
		$data_cell_losets[$i]["npc_b4"]  = "npclo{$i}_b4" ;
		$data_cell_losets[$i]["lpc_b4"]  = "lpclo{$i}_b4" ; 
		$data_cell_losets[$i]["lnpc_b4"] = "lnpclo{$i}_b4" ;
		/*
		$data_cell_wsets_local  = array();
		
		foreach ($data_cell_wsets as $weekid=>$wv) {
		
				$data_cell_wsets_local[$weekid]["name"] = "地域{$i} </br>".$aoki_matrix_weeks[$weekid] ;
				$data_cell_wsets_local[$weekid]["title_cd"] = "tw{$weekid}l{$i}_title" ; 
				$data_cell_wsets_local[$weekid]["pc_b2"] ="pcw{$weekid}l{$i}_b2" ; 
				$data_cell_wsets_local[$weekid]["npc_b2"] ="npcw{$weekid}l{$i}_b2" ;
				
				$data_cell_wsets_local[$weekid]["pc_b3"] ="pcw{$weekid}l{$i}_b3" ; 
				$data_cell_wsets_local[$weekid]["npc_b3"] ="npcw{$weekid}l{$i}_b3" ;
				
				$data_cell_wsets_local[$weekid]["pc_b4"] ="pcw{$weekid}l{$i}_b4" ; 
				$data_cell_wsets_local[$weekid]["npc_b4"] ="npcw{$weekid}l{$i}_b4" ;
		}
		$data_cell_losets[$i]["weeks"]   = $data_cell_wsets_local;
		*/
	}
	//print_r($data_title_map_local_arr);
	
		//-------パタン―の生成---------------------------------------
	$dao_pattern          = new Class_T_PATTERN;
	$dao_pattern->setTableNameWeek($matrix_cd);
	$datapattern          = $dao_pattern -> getpatterns();  
	$data_pattern_arr     = array();
	//$data_pattern_arr[""] = PLEASE_SELECT_ARR ;
	
	foreach ( $datapattern as $k => $v) {
		$data_pattern_arr[$v["pattern_cd"]] = $v["pattern_name"];
	}
		//-------パタン―の生成完了------------------------------------
?>